//	 Copyright 2011 Elian ORIOU
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

package org.eo.geomapper.objects;

import java.util.ArrayList;
import java.util.List;

/**
 * Implements a MultiPoint object (super class of LINE and POLYGON objects)
 * 
 * @author Elian ORIOU
 * 
 */

public class MultiPointObject implements IMultiPointObject {

	private String name;
	private List<GeoPoint> points;

	public MultiPointObject(String name) {
		points = new ArrayList<GeoPoint>();
		this.name = name;
	}

	/**
	 * Adds a point to the object
	 * 
	 * @param p
	 *            The point
	 */

	@Override
	public void addPoint(GeoPoint p) {
		this.points.add(p);
	}

	/**
	 * Returns the list of points attached to the object
	 * 
	 * @return the list of points attached to the object
	 */

	@Override
	public List<GeoPoint> getPoints() {
		return this.points;
	}

	/**
	 * Returns the name of the object
	 * 
	 * @return the name of the object
	 */

	@Override
	public String getName() {
		return this.name;
	}

	/**
	 * Sets the name of the object
	 * 
	 * @param name
	 *            the new name of the object
	 */

	@Override
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Returns the number of points attached to the object
	 * 
	 * @return the number of points attached to the object
	 */

	@Override
	public int getLength() {
		return this.points.size();
	}
}